import type { RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/index.vue'
import { PageEnum } from '@/utils/enums/pageEnums'
import { markRaw } from 'vue'

export const INDEX_ROUTE_NAME = 'Index'

// 使用markRaw包装Layout组件，防止被转为响应式对象
export const LAYOUT = markRaw(Layout)

// 常量路由
export const constantRoutes: RouteRecordRaw[] = [
    {
        path: PageEnum.LOGIN,
        name: 'Login',
        component: () => import('@/views/account/login.vue'),
        meta: {
            title: '登录',
            hidden: true,
        }
    },
    {
        path: '/user',
        name: 'User',
        component: () => LAYOUT,
        meta: {
            title: '用户管理',
            hidden: false,
        },
        children: [
            {
                path: 'index',
                name: 'UserIndex',
                component: () => import('@/views/account/user.vue'),
                meta: {
                    title: '用户管理',
                    selected: '/system/auth/adminapi',
                    hidden: false,
                }
            }
        ]
    }
]

export const INDEX_ROUTE: RouteRecordRaw = {
    path: PageEnum.HOME,
    component: markRaw(Layout),
    name: INDEX_ROUTE_NAME
}



